<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.uploadify.js"></script>
<script type="text/javascript">
$(function() {
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
    $("#file_upload").uploadify({
        'swf'      : "<?=Q::ini('custom_system/base_url')?>js/uploadify.swf",
        'uploader' : "<?=Q::ini('custom_system/base_url')?>js/uploadify.php?>",
        'formData' : { 'path' : "<?=$template['shop_path'] . '/' . $template['path']?>" },
        'onUploadSuccess' : function(file, data, response)
        {
            alert(data);
        }
    });
});
</script>
<style>
.uploadify {
	position: relative;
	margin-bottom: 1em;
}
.uploadify-button {
	background-color: #505050;
	background-image: linear-gradient(bottom, #505050 0%, #707070 100%);
	background-image: -o-linear-gradient(bottom, #505050 0%, #707070 100%);
	background-image: -moz-linear-gradient(bottom, #505050 0%, #707070 100%);
	background-image: -webkit-linear-gradient(bottom, #505050 0%, #707070 100%);
	background-image: -ms-linear-gradient(bottom, #505050 0%, #707070 100%);
	background-image: -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0, #505050),
		color-stop(1, #707070)
	);
	background-position: center top;
	background-repeat: no-repeat;
	-webkit-border-radius: 30px;
	-moz-border-radius: 30px;
	border-radius: 30px;
	border: 2px solid #808080;
	color: #FFF;
	font: bold 12px Arial, Helvetica, sans-serif;
	text-align: center;
	text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
	width: 100%;
}
.uploadify:hover .uploadify-button {
	background-color: #606060;
	background-image: linear-gradient(top, #606060 0%, #808080 100%);
	background-image: -o-linear-gradient(top, #606060 0%, #808080 100%);
	background-image: -moz-linear-gradient(top, #606060 0%, #808080 100%);
	background-image: -webkit-linear-gradient(top, #606060 0%, #808080 100%);
	background-image: -ms-linear-gradient(top, #606060 0%, #808080 100%);
	background-image: -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0, #606060),
		color-stop(1, #808080)
	);
	background-position: center bottom;
}
.uploadify-button.disabled {
	background-color: #D0D0D0;
	color: #808080;
}
.uploadify-queue {
	margin-bottom: 1em;
}
.uploadify-queue-item {
	background-color: #F5F5F5;
	-webkit-border-radius: 3px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	font: 11px Verdana, Geneva, sans-serif;
	margin-top: 5px;
	max-width: 350px;
	padding: 10px;
}
.uploadify-error {
	background-color: #FDE5DD !important;
}
.uploadify-queue-item .cancel a {
	background: url('../img/uploadify-cancel.png') 0 0 no-repeat;
	float: right;
	height:	16px;
	text-indent: -9999px;
	width: 16px;
}
.uploadify-queue-item.completed {
	background-color: #E5E5E5;
}
.uploadify-progress {
	background-color: #E5E5E5;
	margin-top: 10px;
	width: 100%;
}
.uploadify-progress-bar {
	background-color: #0099FF;
	height: 3px;
	width: 1px;
}
</style>
<h3>上传模板信息</h3>
<table class="form_table" width="50%">
<tr>
	<th>所属模板</th>
	<td><strong><?=$template['name']?></strong></td>
	<th>模板路径</th>
	<td><strong><?=$template['path']?></strong></td>
</tr>
<tr>
	<th>所属店铺</th>
	<td><strong><?=$template['shop_name']?></strong></td>
	<th>店铺路径</th>
	<td><strong><?=$template['shop_path']?></strong></td>
</tr>
</table>
<br />
<h3>上传文件</h3>
<p><input type="file" name="file_upload" id="file_upload" /></p>
<br />
<h3>所在目录文件列表</h3>
<a onclick="location.reload();">点击刷新列表</a>
<table class="list_table" width="45%">
	<tr>
		<th>文件名称</th>
		<th width="100">操作</th>
	</tr>
	<?foreach(Helper_BSS_Normal::getDirlist(Q::ini('custom_system/ebay_template_local_dir') . $template['shop_path'] . '/' . $template['path']) as $f):?>
	<tr>
		<td align="left"><a <?if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'png', 'jpg'))):?>rel="pretty_photo[]"<?endif;?> href="<?=Q::ini('custom_system/ebay_template_local_url') . $template['shop_path'] . '/' . $template['path'] . '/' . $f?>"><?=$f?></a></td>
		<td><a href="<?=url('Online::EbayTemplate/FilesListDelete', array('path' => $template['path'], 'shop_path' => $template['shop_path'], 'filename' => $f))?>" onclick="if(!confirm('确定删除？')) return false;">删除</a></td>
	</tr>
	<?endforeach;?>
</table>
<?php $this->_endblock();?>